package com.ruoyi.member.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.db.domain.MemberLoginsession;
import com.ruoyi.db.mapper.MemberLoginsessionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.member.service.IMemberLoginsessionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 登陆信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-08-02
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class MemberLoginsessionServiceImpl implements IMemberLoginsessionService 
{
    @Autowired
    private MemberLoginsessionMapper memberLoginsessionMapper;

    /**
     * 查询登陆信息
     * 
     * @param token 登陆信息主键
     * @return 登陆信息
     */
    @Override
    public MemberLoginsession selectMemberLoginsessionByToken(String token)
    {
        return memberLoginsessionMapper.selectMemberLoginsessionByToken(token);
    }
    @Override
    public List<Map<String, Object>> selectMemberLoginsessionByUid(Long uid)
    {
        return memberLoginsessionMapper.selectMemberLoginsessionByUid(uid);
    }

    /**
     * 查询登陆信息列表
     * 
     * @param memberLoginsession 登陆信息
     * @return 登陆信息
     */
    @Override
    public List<MemberLoginsession> selectMemberLoginsessionList(MemberLoginsession memberLoginsession)
    {
        return memberLoginsessionMapper.selectMemberLoginsessionList(memberLoginsession);
    }

    /**
     * 查询登陆信息列表
     *
     * @param memberLoginsession 登陆信息
     * @return 登陆信息
     */
    @Override
    public List<Map<String, Object>> selectMemberLoginsessionListMap(MemberLoginsession memberLoginsession)
    {
        return memberLoginsessionMapper.selectMemberLoginsessionListMap(memberLoginsession);
    }

    /**
     * 新增登陆信息
     * 
     * @param memberLoginsession 登陆信息
     * @return 结果
     */
    @Override
    public int insertMemberLoginsession(MemberLoginsession memberLoginsession)
    {
        return memberLoginsessionMapper.insertMemberLoginsession(memberLoginsession);
    }

    /**
     * 修改登陆信息
     * 
     * @param memberLoginsession 登陆信息
     * @return 结果
     */
    @Override
    public int updateMemberLoginsession(MemberLoginsession memberLoginsession)
    {
        memberLoginsession.setUpdateTime(DateUtils.getNowDate());
        return memberLoginsessionMapper.updateMemberLoginsession(memberLoginsession);
    }

    /**
     * 批量删除登陆信息
     * 
     * @param tokens 需要删除的登陆信息主键
     * @return 结果
     */
    @Override
    public int deleteMemberLoginsessionByTokens(String tokens)
    {
        return memberLoginsessionMapper.deleteMemberLoginsessionByTokens(Convert.toStrArray(tokens));
    }

    /**
     * 删除登陆信息信息
     * 
     * @param token 登陆信息主键
     * @return 结果
     */
    @Override
    public int deleteMemberLoginsessionByToken(String token)
    {
        return memberLoginsessionMapper.deleteMemberLoginsessionByToken(token);
    }

    @Override
    public List<Map<String, Object>> selectCountlist(MemberLoginsession memberLoginsession) {
        return memberLoginsessionMapper.selectCountlist(memberLoginsession);
    }
}
